
<script lang="ts">
import {Search} from "@element-plus/icons-vue";
import {mixins, Options} from 'vue-class-component';
import {getCustomer} from "@/apis/customer.api";
import CustomerModel from "@/models/CustomerModel";
import {markRaw} from "vue";
import PageMixin from "@/mixins/page.mixin";
import DictMixin from "@/mixins/dict.mixin";

@Options({})
export default class CustomerListView extends mixins(PageMixin, DictMixin) {
  customerName = '';
  search = markRaw(Search);
  customerList: CustomerModel[] | null = null;

  created() {
    this.getData();
  }

  createCustomer() {
    this.$router.push('/customer/create')
  }

  getData() {
    getCustomer(this.customerName, this.currentPage, this.pageSize).then(value => {
      this.customerList = value.content
      this.recordCount = value.totalElements;
    })
  }

  handleEdit(rowId: number): void {
    this.$router.push('/customer/create/' + rowId)
  }

  handleDelete(rowIndex: number, row: CustomerModel): void {
    console.log(rowIndex, row)
  }
}
</script>

<style scoped>

</style>